//搜索下拉框  不好用
function renderSearchSelectHead(thElem, col) {
    thElem.className = 'et-search-input-th';
    thElem.innerText = col.title;
}
//行号
function renderSearchSelectBody(tdElem, col, rawData, index) {
    let inputElem = document.createElement('input');
    inputElem.setAttribute('list', col.field + "_list_" + index);
    inputElem.tabIndex = '10000';
    tdElem.appendChild(inputElem);

    let datalistElem = document.createElement('datalist');
    tdElem.appendChild(datalistElem);
    datalistElem.id = inputElem.getAttribute('list');
    //创建list
    for (let optData of col.select) {
        let optionElem = document.createElement("option");
        optionElem.value = optData.text;
        optionElem.data = optData.value;
        datalistElem.appendChild(optionElem);
    }

    inputElem.onblur = function () {
        rawData[col.field] = inputElem.value;
        // for (let optData of col.select) {
        //     if (optData.value.indexOf(val) >= 0) {
        //         inputElem.innerText = optData.value;
        //         return;
        //     }
        // }
        // //都没有匹配的 认为是第一个
        // inputElem.value = col.select[0].text
    };
}
export { renderSearchSelectHead, renderSearchSelectBody };